package org.crazyit.activiti_d2._2_C3P0Config;

import org.activiti.engine.ProcessEngineConfiguration;

import javax.sql.DataSource;
import java.sql.SQLException;

public class C3P0Config_1 {

    public static void main(String[] args) throws SQLException {

        //1. 读取dbcp-config.xml 配置文件, 创建流程引擎配置类
        ProcessEngineConfiguration config = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("c3p0-config.xml");

        //2. 能正常输出, 即完成配置
        DataSource ds = config.getDataSource();

        //3. 查询数据库元信息, 如果能查询则表示连接成功
        //结果为MySQL Connector Java
        System.out.println(ds.getConnection().getMetaData().getDriverName());
        //结果为com.mchange.v2.c3p0.ComboPooledDataSource
        System.out.println(ds.getClass().getName());

    }

}
